package test2;
import java.util.Arrays;
import java.util.Scanner;

public class PTA {
public static void main(String[] args) {
String[] IDcard=new String[10];
int n=0;
Scanner sc=new Scanner(System.in);
String str=sc.nextLine();
while(str.equals("end")==false){
if(str.length()>10)
if(str.length()==18){
IDcard[n]=str;
n+=1;
}
str=sc.nextLine();
}
while(str.equals("end")){
System.out.println(n+1);
Arrays.sort(IDcard);
for(int j=n;j>=0;j--){
System.out.println(IDcard[j]);
}
String begin;
String End;
begin=sc.next();
End=sc.next();
String[] key=new String[5];
int j=0;
for(int i=0;i if(IDcard[i].compareTo(begin)>=0&&IDcard[i].compareTo(begin)<0);{
key[j]=IDcard[i];
j++;
}

    Arrays.sort(key);
}
for(int i=0;i<j;i++){
    key[i]=key[i].substring(7, 13);
}

Arrays.toString(key);
}
}    

